home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_12_07
/
wilde
/
conv.syn
< prev
next >
Wrap
Text File
|
1993-11-27
|
2KB
|
65 lines
{
/*
File: CONV.SYN - AnaGram syntax file for
conversion program;
Version 1
*/
#include "string.h"
#include "convutil.h"
}
[
parser file name = "conv.cpp"
]
grammar
-> record?..., eof
(void) record
-> valid record, newline =cleanUp();
-> bad data, newline =cleanUp();
bad data
-> error =wrError(PCB.line, PCB.column);
(void) valid record
-> "class", attribute list =putClass();
-> "instanceVariable",
attribute list =putInstanceVariable();
// six other record types handled similarly
attribute list
-> tab, attribute
-> attribute list, tab, attribute
(void) attribute
-> "name@", value:a =atAdd(NAME, a);
-> "file@", value:a =atAdd(FILEN, a);
-> "line@", value:a =atAdd(LINE, a);
// twelve other attribute types handled similarly
(char *) value
-> value contents =release();
(void) value contents
-> value char:c =collectFirst(c);
-> value contents, value char:c =collect(c);
// =============== lexical definitions ================
eof = -1 + 0 + ^Z
newline = '\n'
tab = '\t'
value char = ~(eof + tab + '@' + newline)
// Supporting C++ code follows
{
int main(int argc, char * argv[]) {
if (FALSE == setErrorFile(argv[1])) {
fprintf(stderr, "Couldn't open error file\n");
return 1;
}
conv();
return 0;
}
}